package com.captjack.micro.api.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author Capt Jack
 * @date 2018/3/7
 */
@Configuration
public class LoadBalanceConfig {

    /**
     * LoadBalanced注解表明这个restTemplate开启负载均衡的功能
     *
     * @return 负载均衡管理
     */
    @Bean(value = "restTemplate")
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

}
